<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: Mr.Feng
  Date: 2023/5/25
  Time: 14:09
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>新书推荐</title>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/jquery.pagination.css"/>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/bootstrap.css"/>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/bootstrap-responsive.css"/>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/style.css"/>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/bootstrap.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/ckform.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/common.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.pagination.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/my.js"></script>
    <script>
        $(function () {
            var cp = parseInt($("#curPage").val());
            var tp = parseInt($("#tolPage").val());
            $("#pagination2").pagination({
                currentPage: cp,
                totalPage: tp,
                isShow: false,
                count: 5,
                prevPageText: "< 上一页",
                nextPageText: "下一页 >",
                callback: function (current) {
                    location.href = '/book/list/' + current;
                }
            });
        });
    </script>
</head>
<body>

<table class="table table-bordered table-hover definewidth m10">
    <thead>
    <tr>
        <th> 图书名称</th>
        <th> 图书作者</th>
        <th> 出版社</th>
        <th> 标准ISBN</th>
        <th> 书籍状态</th>
        <th> 借阅人</th>
        <th> 借阅时间</th>
        <th> 预计归还时间</th>
        <th> 操作</th>
    </tr>
    </thead>
    <tbody>
    <c:forEach items="${pageResult.rows}" var="book">
        <tr>
            <td>${book.name}</td>
            <td>${book.author}</td>
            <td>${book.press}</td>
            <td>${book.isbn}</td>
            <td>
                <c:if test="${book.status ==0}">可借阅</c:if>
                <c:if test="${book.status ==1}">借阅中</c:if>
                <c:if test="${book.status ==2}">归还中</c:if>
            </td>
            <td>${book.borrower}</td>
            <td>${book.borrowTime}</td>
            <td>${book.returnTime}</td>
            <td>
                <c:if test="${book.status ==0}">
                    <button type="button" class="btn btn-success" data-toggle="modal" data-target="#borrowModal"
                            onclick="findBookById(${book.id},'borrow')"> 借阅
                    </button>
                </c:if>
                <c:if test="${book.status ==1|| book.status ==2}">
                    <button type="button" class="btn btn-info" disabled="true">借阅</button>
                </c:if>
            </td>
        </tr>
    </c:forEach>
    </tbody>
</table>
<jsp:include page="book_modal.jsp"></jsp:include>
</body>
</html>
